#include <iostream>
#include <string>
#include <cmath>

using namespace std;

class my_class
{
private:
    double c_r; // 半径
public:
    
    // 初始化列表
    my_class(double r) : c_r(r)
    {
        cout << "构造函数被调用,半径r = " << r << endl;
    }

    // 拷贝构造
    my_class(const my_class & r2): c_r(r2.c_r)
    {
        c_r = r2.c_r;
        cout << "拷贝构造函数被调用" << endl;
    }
    
    // 判断两个圆是否相切
    bool isTouch(my_class & r2)
    {
        double sumdistance = c_r + r2.c_r;
        double diffdistance = abs(c_r - r2.c_r);
        
        double distance = sqrt(pow(c_r - r2.c_r, 2));
        return distance == sumdistance || distance == diffdistance;
    }
};

int main(int argc, char const *argv[])
{
    my_class c1(5.0);
    my_class c2(3.0);

    cout << "c1 和 c2 相切吗？ " << (c1.isTouch(c2)? "是" : "否") << endl;
    
    return 0;
}
